package com.atguigu.gmall.task.scheduled;


import com.atguigu.gmall.mq.mqconst.MqTaskConst;
import com.atguigu.gmall.mq.service.RabbitService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;


@Component
@EnableScheduling
@Slf4j
public class ScheduledTask {

    @Autowired
    private RabbitService rabbitService;

    @Scheduled(cron = "0 0 1 * * ?")
    public void taskToLoadCache() {
        rabbitService.sendMessage(MqTaskConst.EXCHANGE_TASK, MqTaskConst.ROUTING_KEY_TASK, "SECKILL_PRE_HOT");
    }

}
